#!/bin/sh

#  Copyright (C) 2013 Curt Brune <curt@cumulusnetworks.com>
#
#  SPDX-License-Identifier:     GPL-2.0

##
## Run all start scripts in /etc/rc$runlev.d/
##
## This assumes the shell is ash/dash.
##

PATH=/usr/bin:/usr/sbin:/bin:/sbin

runlevel=$1

[ -d /etc/rc${runlevel}.d ] || exit 0

if [ ${runlevel} = 6 -o ${runlevel} = 0 ]; then
    script_prefix="K"
    script_action="stop"
else
    script_prefix="S"
    script_action="start"
fi

for s in /etc/rc${runlevel}.d/${script_prefix}* ; do
    $s ${script_action}
done

exit 0

# Local Variables:
# mode: shell-script
# eval: (sh-set-shell "/bin/sh" t nil)
# End:
